<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>现代旅游餐饮系统</title>
<script type="text/javascript" src='<s:url value="/resources/js/jquery/jquery-1.5.2.min.js"/>'></script>

</head>
<link rel="stylesheet" type="text/css" href="<s:url value='/resources/css/food/frame.css'/>" media="all" />


<script type="text/javascript">
	function returnMain(){
		window.location.href="<s:url value='/food/food.do?id=3'/>" ;
		
	}
	$(".guide_icon").live('click',function(){
		$(".guide_icon_c").css({"background":""});
		$(".guide_icon").css({"background":""});
		reback();
		 $(this).css({"background":"url(<s:url value='/resources/images/food/result/selectbackbig.png'/>)  repeat scroll 0 0 transparent"});
	});
	$(".guide_icon_c").live('click',function(){
		$(".guide_icon").css({"background":""});
		$(".guide_icon_c").css({"background":""});
		 $(this).css({"background":"url(<s:url value='/resources/images/food/result/selectbackbig.png'/>)  repeat scroll 0 0 transparent"});
		 $(".guide_icon").eq(1).css({"background":"url(<s:url value='/resources/images/food/result/selectbackbig.png'/>)  repeat scroll 0 0 transparent"});
	});
	var cTime=30;//这个变量是倒计时的秒数设置为10就是10秒
	var flag=false;
	var findto=false;
	var url=1;
	var type = "<s:property value='#request.type'/>";
	$(function(){
		if(type =="1"){
			$(".guide_icon").eq(1).css({"background":"url(<s:url value='/resources/images/food/result/selectbackbig.png'/>)  repeat scroll 0 0 transparent"});
			$(".guide_icon_c").eq(0).css({"background":"url(<s:url value='/resources/images/food/result/selectbackbig.png'/>)  repeat scroll 0 0 transparent"});
			
			guidefind();
		}else if(type == "2"){
			$(".guide_icon").eq(1).css({"background":"url(<s:url value='/resources/images/food/result/selectbackbig.png'/>)  repeat scroll 0 0 transparent"});
			$(".guide_icon_c").eq(1).css({"background":"url(<s:url value='/resources/images/food/result/selectbackbig.png'/>)  repeat scroll 0 0 transparent"});
			travelfind();
		}else if(type =="3"){
			$(".guide_icon").eq(1).css({"background":"url(<s:url value='/resources/images/food/result/selectbackbig.png'/>)  repeat scroll 0 0 transparent"});
			$(".guide_icon_c").eq(2).css({"background":"url(<s:url value='/resources/images/food/result/selectbackbig.png'/>)  repeat scroll 0 0 transparent"});
			cardfind();
		}else{
			$(".guide_icon").eq(0).css({"background":"url(<s:url value='/resources/images/food/result/selectbackbig.png'/>)  repeat scroll 0 0 transparent"});
			signway();
		}
		$("#inputcardcode").focus();
		
		//5秒检测一次input是否为焦点
		time=setInterval(function(){
			$("#inputcardcode").focus();
		}, 5*1000);
		//二维码扫描结果的回车键
		$("#inputcardcode").bind('keydown', function (e) {
            var key = e.which;
 
            if (key == 13) {
            	var planid=$(this).val();
            	CloseWindow_Click(planid); 
            	$(this).val("");
            	//不再返回给浏览器
            	return false;
            }
        });
		$("#inputcardcode").live('onchange',function(){
			
			
		});
	});
	function reback(){
		$("#iconmysign").attr("src","<s:url value='/resources/images/food/result/signbuttonb.png' />");	
		$("#iconfindg").attr("src","<s:url value='/resources/images/food/result/guidefindb.png' />");
		$("#iconfindt").attr("src","<s:url value='/resources/images/food/result/travelfindb.png' />");
		$("#iconcard").attr("src","<s:url value='/resources/images/food/result/cardfindb.png' />");
	}
	function signway(){
		findto=true;
		$(".plan").hide();
		document.getElementById("showMessage").innerHTML ="请刷身份证或行程码……";
		$(".idcontent").show();
		reback();
		$("#iconmysign").attr("src","<s:url value='/resources/images/food/result/signbuttonw.png' />");
		
		
		flag=false;
		cTime=1;
		url=4;
		/*  TimeClose();  */
		
		
	}
	function guidefind(){
		findto=true;
		reback();
		$("#iconfindg").attr("src","<s:url value='/resources/images/food/result/guidefindw.png' />");
		$(".plan").hide();
		document.getElementById("showMessage").innerHTML ="请刷身份证或行程码……";
		$(".idcontent").show();
		flag=false;
		cTime=1;
		url=1;
		  /*   TimeClose();  */ 
		
	}
	function travelfind(){
		findto=true;
		reback();
		$("#iconfindt").attr("src","<s:url value='/resources/images/food/result/travelfindw.png' />");
		$(".plan").hide();
		document.getElementById("showMessage").innerHTML ="请刷身份证……";
		$(".idcontent").show();
		flag=false;
		cTime=1;
		url=2;
		/*  TimeClose();  */
		
	}
	function cardfind(){
		findto=true;
		reback();
		$("#iconcard").attr("src","<s:url value='/resources/images/food/result/cardfindw.png' />");
		$(".plan").hide();
		document.getElementById("showMessage").innerHTML ="请刷行程码……";
		$(".idcontent").show();
		
		flag=false;
		cTime=10;
		url =3;
	 	/* TimeClose();  */ 
		
	}
	
	
	 /*  function TimeClose()
	{	
	     document.getElementById("showMessage").innerHTML ="请刷行程码或身份证……";//显示倒计时时间 
	     
	}*/   
	 
	
	 
	  function TimeClose()
	{	if(flag!=true){
	     window.setTimeout('TimeClose()',1000);//让程序每秒重复执行当前函数。
		}
	     if(cTime<=0)//判断秒数如果为0
	      {CloseWindow_Click('533123198907092816');//执行关闭网页的操作
	      cTime=30;
	      }
	     document.getElementById("showMessage").innerHTML ="请刷身份证.......倒计时"+cTime+"秒后结束读卡";//显示倒计时时间
	     
	     cTime--;//减少秒数
	}    
	function CloseWindow_Click(cardId)
	{
		if(findto){
			flag=true;
			$(".idcontent").hide();
			var contextpath="<%=request.getContextPath()%>";
			var myid="<s:property value='#request.place.id'/>";
			//跳转加载数据
			if(url ==1){
				url = contextpath+"/food/guideFind.do?id="+myid+"&code="+cardId;
				$(".plan").html("<iframe  class='briframe' frameborder='0' width='730px' src='"+url+"'></iframe>");
			}else if(url==2){
				url = contextpath+"/food/travelFind.do?id="+myid+"&code="+cardId;
				$(".plan").html("<iframe class='briframe' frameborder='0' width='730px'src='"+url+"'></iframe>");
			}else if(url==3){
				url = contextpath+"/food/findBYCode.do?id="+myid+"&code="+cardId;
				$(".plan").html("<iframe class='briframe' frameborder='0' width='730px' src='"+url+"'></iframe>");
			}else{
				url = contextpath+"/food/signSuccess.do?id="+myid+"&code="+cardId;
				$(".plan").html("<iframe class='briframe' frameborder='0' width='730px' src='"+url+"'></iframe>");
			}
			findto=false;
			$(".plan").show();
		}
		
	}

	function windowclose() { 
	var browserName = navigator.appName; 
	if (browserName=="Netscape") { 
	window.open('', '_self', ''); 
	window.close(); 
	} 
	else { 
	if (browserName == "Microsoft Internet Explorer"){ 
	window.opener = "whocares"; 
	window.opener = null; 
	window.open('', '_top'); 
	window.close(); 
	} 
	} 
	} 
	
</script>
<body style="width: 1024px;height: 768px;margin: 0 0 0 0;padding: 0 0 0 0;">
<jsp:include page="/web/food/topbottom/optop.jsp"></jsp:include>
	<div class="context">
		<div class="left">
			<div class="guide">
				<div class="guide_icon" onclick="javascript:signway()"><img alt="" id="iconmysign" class="iconfind" src="<s:url value="/resources/images/food/result/signbuttonb.png" />"></div>
				<div class="guide_icon">
					<img alt=""  src="<s:url value="/resources/images/food/result/findbuttonb.png" />" class="iconfind">
					
				</div>
				<div class="guide_icon_c" onclick="javascript:guidefind()">
					<img id="iconfindg" alt="" src="<s:url value="/resources/images/food/result/guidefindb.png" />" class="iconlitf">
				</div>
				<div class="guide_icon_c" onclick="javascript:travelfind()">
					<img id="iconfindt" alt="" src="<s:url value="/resources/images/food/result/travelfindb.png" />" class="iconlitf">
				</div>
				<div class="guide_icon_c" onclick="javascript:cardfind()">
					<img id="iconcard" alt="" src="<s:url value="/resources/images/food/result/cardfindb.png" />" class="iconlitf">
				</div>
				
			</div>
			<%-- <div class="shopping">
				<div class="shopping_icon"><img alt="" src="<s:url value="/resources/images/shop/guide/shopping_icon.png" />"></div>
				<div class="shoppingText">购物结算</div>
				<div class="clr"></div>
			</div> --%>
			<div class="intoHome" onclick="javascript:returnMain();">
				
				<div class="homeIcon" style="cursor:pointer;">
					<img  alt="" src="<s:url value='/resources/images/food/main/intoMain.png' />" />
				</div>
				
				<div class="clr"></div>
			</div>
		</div>
		<div class="right"><input id='inputcardcode'  type='text'  size="1" style='border-left:0px;border-top:0px;color:white; border-right:0px;border-bottom:1px '/>
			<div class="idcontent">
				<div class="idcase">
				<div id="showMessage" style="font-size: 24px;color: white;">请刷行程码或身份证.......</div>
				</div>
			</div>
			<div class="plan">
			<div class="welText"><s:property value="#request.place.name"/>欢迎您！</div>
			</div>
		</div>
		
		<div class="clr"></div>
	</div>
	<jsp:include page="/web/food/topbottom/bottom.jsp"></jsp:include>
</body>
</html>